package o;

import android.content.Context;
import android.content.pm.PackageManager;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appgallery.packagemanager.api.bean.ManagerTask;
import com.huawei.appmarket.service.deamon.bean.DownloadHistory;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import o.ewm.n;

public class dwn {
    public static void ˊ(ManagerTask managerTask) {
        Context ˋ = ContentManager.getInstant().getContext();
        if (epw.ॱ(ˋ, managerTask.packageName)) {
            String ˎ = ˎ(managerTask);
            evk.ˋ(ˋ, ˋ.getString(n.ˋᴵ, new Object[]{ˎ}), 0).ˋ();
            managerTask.ʼ = true;
            return;
        }
        managerTask.ʼ = false;
    }

    public static String ˎ(ManagerTask managerTask) {
        PackageManager packageManager = ContentManager.getInstant().getContext().getPackageManager();
        String ॱ = ॱ(managerTask);
        try {
            ॱ = packageManager.getApplicationInfo(managerTask.packageName, DnsConfig.MAX_CACHE_ENTRIES).loadLabel(packageManager).toString();
        } catch (Throwable e) {
            Logger.ˋ("ManagerTaskUtil", "cannot get ApplicationInfo pii", e);
        }
        return ॱ;
    }

    public static String ॱ(ManagerTask managerTask) {
        if (managerTask.ॱॱ instanceof SessionDownloadTask) {
            return ((SessionDownloadTask) managerTask.ॱॱ).ʿ();
        }
        if (managerTask.ॱॱ instanceof cog) {
            return ((cog) managerTask.ॱॱ).ˊ();
        }
        if (managerTask.ॱॱ instanceof DownloadHistory) {
            return ((DownloadHistory) managerTask.ॱॱ).ˏॱ();
        }
        return "";
    }
}
